package com.lxg.service.adminService.impl;

import com.lxg.dao.ProblemDao;
import com.lxg.pojo.Problem;
import com.lxg.service.adminService.AdminProblemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;

@Service
public class AdminProblemServiceImpl implements AdminProblemService {
    @Autowired
    ProblemDao problemDao;

    /**
     * 查询全部的问题
     * @return allProblem
     */
    @Override
    public ArrayList<Problem> getAllProblem() {
        ArrayList<Problem> allProblem = problemDao.getAllProblem();
        return allProblem;
    }


    /**
     * 查询未解决的问题
     * @return allUnsolved
     */
    @Override
    public ArrayList<Problem> getAllUnsolved() {
        ArrayList<Problem> allUnsolved = problemDao.getAllUnsolved();
        return allUnsolved;
    }


    /**
     * 查询已经解决的问题
     * @return allSolved
     */
    @Override
    public ArrayList<Problem> getAllSolved() {
        ArrayList<Problem> allSolved = problemDao.getAllSolved();
        return allSolved;
    }


    /**
     * 根据pid查询问题
     * @param pid
     * @return problem
     */
    @Override
    public Problem getProblemByPid(Integer pid) {
        Problem problem = problemDao.getProblemByPid(pid);
        return problem;
    }


    /**
     * 修改问题的状态，改为已解决
     * @param pid
     */
    @Override
    public boolean updateProblem(Integer pid) {
        problemDao.updateProblem(pid);
        return true;
    }
}
